import time
# class Transfer(data):


# groupManager = {}

# selectIndex = 0

# def getSelectIndex(index):
#     print("选中的group是",index)


# def getDataArray(arr):
#     print("切换group时的arr ===",arr)
class resultJudgment():

    def showDatas(treeview,datas,resultArray,index,testDict):

        # for item in datas:
        #     print(item)
        # for item in datas:
        #     testDict = item
            upperLimit = 0
            value = 0
            lowerLimit = 0
            if testDict["upperLimit"] != "":
                upperLimit = int(testDict["upperLimit"])
            if testDict["value"]:
                print("---main---value :",testDict["value"])
            if testDict["value"] == False or testDict["value"] == True:
                value = testDict["value"]
            else:
                try:
                    value = float(testDict["value"])
                except ValueError as e:
                    value = testDict["value"]
                
            if testDict["lowerLimit"] != "":
                lowerLimit = float(testDict["lowerLimit"])
            
            passResult = "fail"
            # 上下限都有
            if testDict["upperLimit"] != "" and testDict["lowerLimit"] != "":
                print("上下限都有")
                if value >= lowerLimit and value <= upperLimit:
                    passResult = "pass"

            # 只有上限
            if testDict["upperLimit"] != "" and testDict["lowerLimit"] == "":
                print("只有上限")
                if value < upperLimit:
                    passResult = "pass"
            # 只有下限
            if testDict["upperLimit"] == "" and testDict["lowerLimit"] != "":
                print("只有下限")
                if value > lowerLimit:
                    passResult = "pass"

            if testDict["upperLimit"] == "" and testDict["lowerLimit"] == "":
                passResult = "pass"
            if value == True:
                passResult = "pass"
            if value == False:
                passResult = "fail"

            tag = testDict["id"]
            gridValues = (
                            f"{tag}",
                            testDict["TestName"],
                            testDict["subTestName"],
                            testDict["subSubTestName"],
                            testDict["upperLimit"],
                            testDict["value"],
                            testDict["lowerLimit"],
                            passResult,
                            "no info",
                            "10"
            )
            return passResult

            
